#ifndef BOOK_H
#define BOOK_H


#include "record.h"
#include "book_info.h"
#include "comment.h"

#include "tools.h"

class Book//书的详细信息
{
public:
	string m_name;				//书名
	string m_author;			//作者
	unsigned int m_id;			//书号
	string m_type;				//类别
	struct tm m_intime;  		//入库时间
	unsigned int m_amout;		//剩余数量
	unsigned int m_total;		//总数
	double m_score;				//评分 1-5分
	unsigned int m_sco_num ; 	//评分人数
	unsigned int m_recom; 		//推荐数
	string m_syn;				//简介
	bool m_isShelf;    			//1表示上架中0表示已下架
	unsigned int m_numCom ; 	//评论数
	unsigned int m_numRecord;	//借书记录数
	
	// 预约
	class Reserve
	{
	public:
		struct tm m_time;
		unsigned int m_bookId;
		unsigned int m_id;
	};
	
	vector<Reserve>  m_reserve;  //预约记录
	vector<Comment> m_vecCom; //评论
	vector<Record> m_record; //借书记录
	
	Book(void);
	
	// 构造函数
	Book(const char* name,const char* author,unsigned int id,const char* type,struct tm& intime,unsigned int amout,
		unsigned int total,double score,unsigned int sco_num,unsigned int recom,const char* syn,bool isShelf,
			unsigned int numCom,unsigned int numRecord);
	// 删除评论
	bool delComment(unsigned int com_id);
	// 添加借书记录
	void addRecord(Record& record);
	// 添加评论
	void addComment(Comment& com);
	// 获取借书记录 并返回记录指针
	Record* getRecord(unsigned int com_id); 
};

#endif//BOOK_H
